home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 67 / IOPROG_67A.ISO / soft / Tools / mwsppv4.exe / INSERT INDEXOF.SCRIPT < prev    next >
Encoding:
Text File  |  1998-01-06  |  998 b   |  34 lines

  1. !!Script
  2. // Copyright ⌐ 1997-1998 - Modelworks Software
  3.  
  4. // Insert script helper for:
  5.  
  6. /**
  7. @Object: String 
  8. @Method: indexOf - returns the character index of the of 
  9. of the substring.  The search starts at the beginning of the  
  10. string or at the character position specified by start.  
  11. If the substring is not found the value -1 is returned. 
  12.  
  13. IMPORTANT: Do NOT call with a start value greater  
  14. than or equal to the string length.  Thus calling 
  15. indexOf(string, 0) when the string is empty will result 
  16. in a null value being returned for the index (not 
  17. equal to -1 or any other integer). 
  18. @Syntax: string.indexOf(substring, [start])
  19. @Summary: indexOf - returns the character index where the match was found
  20. */
  21.  
  22. function DoCommand()
  23. {
  24.   var editor = getActiveEditor();
  25.   if (editor)
  26.   {
  27.     var selection = editor.getSelection();
  28.     editor.replace("string.indexOf(substring, [start])", selection);
  29.     editor.setActive("Insert string.indexOf");
  30.   }
  31. }
  32.  
  33. !!/Script
  34.